-- card: 9472 from stack: in -- bmap block id: 9799 -- flags: 0000 -- background id: 8327 -- name: XScrollBoxM ----- HyperTalk script ----- on opencard set the visible of field 1 to false -- background field set the scroll of card field 1 to 0 set the scroll of card field 2 to 0 end opencard on closecard set the visible of field 1 to true end closecard -- part 2 (field) -- low flags: 00 -- high flags: 4007 -- rect: left=384 top=62 right=290 bottom=491 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: scroller -- part 3 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=79 top=298 right=320 bottom=179 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XScrollBoxM ----- HyperTalk script ----- on mouseUp put empty into msg put "1,3,5" into initial get XScrollBoxM(initial,"Choose one of these:",card field "scroller","Help") if it is "Help" then put "You pushed the 'Help' button." else if it is empty then put "You pushed the 'Cancel' button." else put "Your choice was: " & it end if end mouseUp -- part 5 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=18 top=32 right=290 bottom=384 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XCMD Text -- part contents for card part 2 ----- text ----- able baker charlie dog ernest fox gamma horse ice cream jumping jack flash knockwurst liver monkey no way, jose occularity penelope qwerty rapscallion salubrious twinkle toes underwhelmed vermin wascally wabbit yokel zenzational -- part contents for card part 5 ----- text ----- XScrollBoxM version 1.7 Roger Brown XScrollBoxM is a version HyperCard XFCN XScrollBox that allows the user to make multiple selections. The return value is an item list in the format: number,text,number,text,..number,text where number is the number of a selection text is the text of the selection with that number Selection can be made by: 1. double-clicking on a line. 2. single-clicking on a line, then pressing the OK button. 3. single-clicking on a line, then pressing the Return key. 4. typing the first letter(s) of a selection, then doing 1,2, or 3. (Note: type selection assumes that the lines are ordered alphabetically) 5. scrolling with up and down arrow keys, then doing 1,2 or 3. Multiple selection is made by holding down the shift key while clicking. If the Cancel button is pressed, a null string is returned. It requires that the DITL and DLOG resources (1347) packaged with it are in the stack. The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a Mac+ screen. INVOKING XScrollBoxM get XScrollBoxM(first,prompt,container,userButton) where first is a list of 1 or more default selections in the list - either numbers or an item list of text strings (0 if none). NOTE: the text must exactly match what is in the field! prompt is a string to prompt the user. This appears at the top of the dialog box. container is any hypercard container (field, variable), presumed to be multi-lined. UserButton is the name for an optional author specified button. If this button is pressed, its name is returned further processing by the script. EXAMPLE ex. get XScrollBoxM("1,2,3","Choose:",card field 1,"Help") if OK is pressed, returns : 1,text of line 1 of card field 1,2,text of line 2 of card field 1,3,ext of line 3 of card field 3 REVISION HISTORY 1.4 - start with XScrollBox 1.4 1.6 - multiple selection by command-shift 1.7 -- 6/5/88 multiple selection by shift only